package org.mat.ipaas.ucenter.service.api.oss;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.mat.framework.lang.dto.MatApiResponse;
import org.mat.ipaas.ucenter.service.dto.oss.entity.OssFileDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * 云存储示例 DEMO
 */
@FeignClient(name = "mat-ipaas-ucenter-service",contextId = "oss-file-rest-api")
public interface OssFileRestAPI {

	@ResponseBody
	@GetMapping("/sys/oss/file/list")
    MatApiResponse<IPage<OssFileDTO>> queryPageList(OssFileDTO file,
													@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
													@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
													@RequestParam HttpServletRequest req);

	@ResponseBody
	@PostMapping("/sys/oss/file/upload")
	//@RequiresRoles("admin")
    //@RequiresPermissions("system:ossFile:upload")
    MatApiResponse upload(@RequestParam("file") MultipartFile multipartFile);

	@ResponseBody
	@DeleteMapping("/sys/oss/file/delete")
    MatApiResponse delete(@RequestParam(name = "id") String id);

	/**
	 * 通过id查询.
	 */
	@ResponseBody
	@GetMapping("/sys/oss/file/queryById")
    MatApiResponse<OssFileDTO> queryById(@RequestParam(name = "id") String id);

}
